using DiLu.Expansion.File.Configs;
using FluentFTP;

namespace DiLu.Expansion.File.Operates.FTP.Configs;

/// <summary>
///     删除FTP文件夹配置
/// </summary>
public record DeleteFtpFolderConfig : DeleteFolderConfig
{
    /// <summary>
    ///     删除FTP文件夹配置
    /// </summary>
    /// <param name="directoryFullPath">目录完整路径</param>
    /// <param name="ftpClient">FTP客户端</param>
    /// <param name="autoCloseFtpClient">
    ///     自动关闭FTP客户端 默认自动关闭客户端连接
    ///     如果为false需要自行调用 CloseFtpClientConnectAsync()方法
    /// </param>
    public DeleteFtpFolderConfig(string directoryFullPath, AsyncFtpClient ftpClient, bool autoCloseFtpClient)
        : base(directoryFullPath)
    {
        ArgumentNullException.ThrowIfNull(ftpClient, nameof(ftpClient));
        FtpClient = ftpClient;
        AutoCloseFtpClient = autoCloseFtpClient;
    }

    /// <summary>
    ///     删除FTP文件夹配置
    /// </summary>
    /// <param name="rootDirectory">根目录</param>
    /// <param name="fileGroupName">文件分组名称</param>
    /// <param name="directoryRelativePath">目录相对路径</param>
    /// <param name="ftpClient">FTP客户端</param>
    /// <param name="autoCloseFtpClient">
    ///     自动关闭FTP客户端 默认自动关闭客户端连接
    ///     如果为false需要自行调用 CloseFtpClientConnectAsync()方法
    /// </param>
    public DeleteFtpFolderConfig(string rootDirectory, string fileGroupName, string directoryRelativePath,
        AsyncFtpClient ftpClient, bool autoCloseFtpClient)
        : base(rootDirectory, fileGroupName, directoryRelativePath)
    {
        ArgumentNullException.ThrowIfNull(ftpClient, nameof(ftpClient));
        FtpClient = ftpClient;
        AutoCloseFtpClient = autoCloseFtpClient;
    }

    /// <summary>
    ///     FTP客户端
    /// </summary>
    public AsyncFtpClient FtpClient { get; }

    /// <summary>
    ///     自动关闭FTP客户端
    /// </summary>
    public bool AutoCloseFtpClient { get; }
}